import React, { Component } from "react";

const Child = (props) => {
  console.log(props);
  return (
    <div>
      {/* {props.children[0]} - child子组件 - {props.children[1]} */}
      {props.children.title} - child子组件 - {props.children.icon}
    </div>
  );
};

class App extends Component {
  state = {};
  render() {
    return (
      <>
        {/* 具名插槽可以使用传递对象的方式 */}
        <h2>具名插槽</h2>
        <Child>
          {/* <span>123</span>
          <span>456</span> */}

          {{
            title: <span>123</span>,
            icon: <span>456</span>,
          }}
        </Child>
      </>
    );
  }
}

export default App;
